home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Enlighten DSM 3.1
/
SGI EnlightenDSM 3.1.iso
/
SCO5X
/
EMD
/
bin
/
start_emdd
< prev
next >
Wrap
Text File
|
1999-04-16
|
4KB
|
172 lines
#!/bin/sh
#
# Script: start_emdd [-v logLevel(0-4)]
#
# start_emdd starts the EMD component of EnlightenDSM
#
# Copyright (c) 1990-1999 Enlighten Software Solutions, Inc.
# All Rights Reserved.
#
# (ksh was used to bypass a variable bug in SCO3's sh. This script
# is /bin/sh compatible.)
#
STARTUP_SECS=10
SHUTDOWN_SECS=10
DEFAULT_LOG_LEVEL=0
PATH=/bin:/usr/bin:/etc:/usr/ucb:/usr/bsd:/usr/etc:$PATH
export PATH
appName=`basename $0` ; export $appName
errorCheck () {
if [ $? -ne 0 ] ; then
echo "$appName: Fatal: Could not start EMD." 1>&2
exit 1
fi
}
logLevel=$DEFAULT_LOG_LEVEL
while [ "$#" -ne 0 ] ; do
case "$1" in
-v* )
logLevel=$2
shift
;;
*)
echo
echo "$appName starts the EMD component of EnlightenDSM."
echo
echo "Usage: $appName [-v <verbosity level (0-4)>]"
echo
exit 1
;;
esac
shift
done
OS=`uname -s` ; export OS
REV=`uname -r` ; export REV
#
# Deal with bsd ps
#
OPTS="-ef"
if [ "$OS" = "SunOS" ]; then
case "$REV" in
4.1.* )
OPTS="-axuww"
;;
esac
fi
#
# Get a valid key file
#
if [ -z "$ENL_KEYS" -o ! -r "$ENL_KEYS" ] ; then
KEY_FILE=/etc/enlighten
else
KEY_FILE=$ENL_KEYS
fi
if [ ! -r "$KEY_FILE" ] ; then
echo "$appName: Fatal: Could not read file $KEY_FILE." 1>&2
echo 1>&2
if [ -f $KEY_FILE ] ; then
echo "$appName: Please run $appName as root." 1>&2
exit 1
else
echo "$appName: Reinstall Enlighten on this host." 1>&2
exit 1
fi
fi
#
# Get EMD_DIR
#
EMD_DIR=`egrep "^emd_dir=" $KEY_FILE | cut "-d=" -f2-`
export EMD_DIR
if [ ! -x $EMD_DIR/bin/emdd ] ; then
echo "$appName: Error: $EMD_DIR/bin/emdd was missing." 1>&2
echo "$appName: Please check $KEY_FILE's value of 'emd_dir='." 1>&2
exit 1
fi
if [ ! -r $EMD_DIR/.odbc.ini ] ; then
echo "$appName: Error: $EMD_DIR/.odbc.ini was missing." 1>&2
echo "$appName: Please reinstall the EMD." 1>&2
exit 1
fi
OLD_PID=`ps $OPTS | grep emdd | egrep -v "$appName|enl_post_install|grep" \
| awk '{ print $2; }'`
if [ ! -z "$OLD_PID" ] ; then
echo "$appName: Killing a previously-started emdd [pid $OLD_PID]"
kill $OLD_PID
if [ $? -ne 0 ] ; then
echo "$appName: Run as user 'root'." 1>&2
exit $?
fi
sleep $SHUTDOWN_SECS
PIDS_THAT_WOULD_NOT_DIE=`ps $OPTS | egrep -e "emdd|enl_se" \
| egrep -v "$appName|enl_post_install|grep" | awk '{ print $2; }'`
if [ ! -z "$PIDS_THAT_WOULD_NOT_DIE" ] ; then
kill -9 $PIDS_THAT_WOULD_NOT_DIE
if [ $? -ne 0 ] ; then
echo "$appName: Run as user 'root'." 1>&2
exit $?
fi
fi
fi
#
# set ENLIGHTEN to EMD_DIR for liblog be able to find message files
#
ENLIGHTEN=$EMD_DIR; export ENLIGHTEN
echo
echo "$appName: Invoking $EMD_DIR/bin/emdd..."
#
# Start the EMD
#
#SQLEXEC=$EMD_DIR/informix/lib/sqlexecd; export SQLEXEC
#DBPATH=$EMD_DIR/dbtables; export DBPATH
#INFORMIXDIR=$EMD_DIR/informix; export INFORMIXDIR
#INFORMIXSERVER=enl_se; export INFORMIXSERVER
#ODBC=$EMD_DIR/odbc/drivers; export ODBC
#HOME=$EMD_DIR; export HOME
#PATH=$EMD_DIR/informix/bin:/bin:$EMD_DIR/bin:/usr/bin:/etc; export PATH
#case "$OS" in
#"HP-UX" )
#SHLIB_PATH=$EMD_DIR/odbc/lib:$EMD_DIR/informix/lib:$SHLIB_PATH
#export SHLIB_PATH
#;;
#* )
#LD_LIBRARY_PATH=$EMD_DIR/odbc/lib:$EMD_DIR/informix/lib:$LD_LIBRARY_PATH
#export LD_LIBRARY_PATH
#;;
#esac
cd $EMD_DIR/bin
./emdd -d -v$logLevel
errorCheck
sleep $STARTUP_SECS;
PEP_PID=`ps $OPTS | grep emdd | egrep -v "$appName|enl_post_install|grep" `
if [ -z "$PEP_PID" ] ; then
echo "$appName: Fatal: EMD did not come up." 1>&2
exit 1
fi
exit 0